home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / cfuncs.zip / MESSAGE.C < prev    next >
C/C++ Source or Header  |  1991-09-12  |  2KB  |  67 lines

  1. #include <funcs.h>
  2. #include <stdarg.h>
  3. /*----------------------------message------------------------------*/
  4. /*DESCRIPTION: Displays a message on the bottom of the screen and  */
  5. /* prompts to press a key to recover.                    */
  6. /*                                   */
  7. /*INPUT:                               */
  8. /*     message = message to be displayed               */
  9. /*     recover = 0 -- "ANY KEY"                   */
  10. /*     recover = 1 -- "ANY KEY TO CONTINUE"               */
  11. /*     recover = 2 -- "ANY KEY TO RECOVER"               */
  12. /*     recover = 3 -- ""                       */
  13. /*RETURNS: the character entered                   */
  14. /*                                   */
  15. /*USES: Frame, GetCursor, OffCursor, SetCursor, GetIdleCh          */
  16. /*-----------------------------------------------------------------*/
  17. char SOUND=1;
  18. char message(int recover, char *format, ... )
  19. {
  20.   char outstr[81];
  21.   va_list arg_ptr;
  22.   FrameDataType F;
  23.   char *recov[] = {"", "(Any Key)", "(Any Key To Continue)",
  24.         "(Any Key To Recover)" };
  25.   char line[79], buff[481], ch;
  26.   char message[81];
  27.   unsigned int  OldCursor;
  28.   int toupper(int ch);
  29.  
  30.   va_start(arg_ptr, format);
  31.   vsprintf(message, format, arg_ptr);
  32.  
  33.   OldCursor = GetCursor();
  34.   OffCursor();
  35.  
  36.   SaveScrn(0, 23, 80, 3, buff);
  37.  
  38.   if(recover < 0 || recover > 3) recover = 3;
  39.   if(strlen(message) > 78 - strlen(recov[recover]))
  40.     message[78-strlen(recov[recover])] = '\0';
  41.  
  42.   sprintf(line, " %s %s ", message, recov[recover]);
  43.  
  44.   F.txt[0] = line;
  45.   F.X = 39-strlen(line)/2; F.Y = 23;
  46.   F.L = 3; F.W = strlen(line)+2;
  47.   F.F = 15; F.B = 4;
  48.   F.BorderType = 2;
  49.   F.clear = 10;  /* no shadow */
  50.   Frame(&F);
  51.  
  52.   if(SOUND)
  53.      Beep(900, 5);
  54.  
  55.   ch = toupper(GetIdleCh());
  56.  
  57.   RestScrn(0, 23, 80, 3, buff);
  58.  
  59.   SetCursor(OldCursor);
  60.   return(ch);
  61. }
  62.  
  63. /*main()
  64. {
  65.   NewClear(7,0);
  66.   message("You just got a pay raise.", 2);
  67. }*/